/**
 * js 服务端api工具类
 * Created by zhangyw on 2018/1/11.
 */
var userAuthc = (function (http) {

    var _self = {};

    _self.doLogin = function (username, password, rememberMe, code) {
        return http.post('/auth/login', {
            username: username,
            password: password,
            rememberMe: rememberMe ? rememberMe : false,
            code: code
        });
    };


    _self.doSmsLogin = function (phone, sms_code, rememberMe) {
        return http.post('/auth/login', {
            phone: phone,
            sms_code: sms_code,
            lf: "sms",
            rememberMe: rememberMe ? rememberMe : false
        });
    };

    /**
     * 获取短信验证码
     */
    _self.getPhoneCode = function (phone) {
        return http.post('/auth/sms', {
            phone: phone
        });
    };

    _self.getQywxQr = function (redirect) {
        return http.post("/auth/qrCode", {redirect: redirect});
    };

    _self.doLogout = function () {
        return http.post('/auth/logout');
    };

    _self.loadMenu = function () {
        return http.get('/auth/menu');
    };

    return _self;
})(http);